package main

import (
	"gitee.com/gin-learn/web25/db"
	"gitee.com/gin-learn/web25/models"
	"gitee.com/gin-learn/web25/routers"

)

var (
	err error
)




func main(){
	// 创建数据库
	// sql: CREATE DATABASE  bubble;
	// 连接数据库
	err = db.InitMySQL()
	if err != nil {
		panic(err)
	}
	defer db.DB.Close()	// 程序退出关闭数据库连接

	// 模型绑定
	db.DB.AutoMigrate(&models.Todo{})	//todos


	r := routers.SetupRouter()



	r.Run()
}
